﻿#region License
/*   QuizzMasterStudio Copyright © 2012 Robert Long
 *  
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *   The full license is also included in the root folder.
 */
#endregion

#region Contact

/* Robert Long
 * Email: rbtLong@live.com
 */

#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace QuizzMasterStudio
{
    /// <summary>
    /// Interaction logic for QuizzMasterListBox.xaml
    /// </summary>
    public partial class QuizzSelector : UserControl
    {
        public event QuizzSelectionChangedEventHandler QuizzSelectionChanged;
        public delegate void QuizzSelectionChangedEventHandler(object sender, SelectionChangedEventArgs e, 
            ListBoxItem itm);

        public QuizzSelector()
        {
            InitializeComponent();
        }

        private void lbxQuizzSelect_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (lbxQuizzSelect.SelectedIndex > -1)
            {
                if (QuizzSelectionChanged != null)
                    QuizzSelectionChanged(sender, e, lbxQuizzSelect.Items[lbxQuizzSelect.SelectedIndex] as ListBoxItem);
                btnEdit.IsEnabled = btnDelete.IsEnabled = lbxQuizzSelect.SelectedIndex > -1;
            }
        }
    }
}
